﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Castle.Windsor.Installer;

namespace RomanNumeralKata
{
    public class BootlegIoc : IDisposable
    {
        private IWindsorContainer _container;

        public IWindsorContainer Container
        {
            get { return _container; }
        }

        public BootlegIoc()
        {
            BootStrap();
        }

        public void BootStrap()
        {
            _container = new WindsorContainer();
            //default wiring, but typically should be wired
            // from that which is consuming this resource, otherwise
            // it's essentially hardcoded.
            Container.Install(FromAssembly.InThisApplication());
            Container.Register(Component.For<RomanNumeralApplication>());
        }

        public void Dispose()
        {
            Container.Dispose();
        }
    }
}
